const http = require('http');
const url = require('url');

module.exports= function(str){
    return new Primise((resolve,reject)=>{
        let client=http.request(url.parse(str),
        res=>{
            let arr=[];
            res.on('data',data=>{
                arr.push(data)
            });
            res.on('end',()=>{
                resolv(Buffer.concat(arr));
            });
            res.on('error',err=>{
                console.log('请求出错');
                reject(err)
            })          
        });
        client.end();
    })
}



